#include <iostream>
#include <cstring>

using namespace std;

bool presented[26], selected[26];
bool les[26][26];

int main()
{
	string curr, prev = "";

	memset(presented, false, sizeof(presented));
	memset(les, false, sizeof(les));

	int count = 0;
	while (cin >> curr)
	{
		if (curr == "#") break;
		if (prev == "")
		{
			prev = curr;
			continue;
		}

		for (int i = 0; i < min(prev.size(), curr.size()); i++)
		{
			if (!presented[prev[i] - 'A']) count++;
			presented[prev[i] - 'A']= true;
			if (!presented[curr[i] - 'A']) count++;
			presented[curr[i] - 'A']= true;

			if (prev[i] != curr[i])
			{
				les[prev[i] - 'A'][curr[i] - 'A'] = true;
				break;
			}
		}

		prev = curr;
	}

	string res = "";
	memset(selected, false, sizeof(selected));

	for (int i = 0; i < count; i++)
	{
		for (int j = 0; j < 26; j++)
			if (presented[j] && !selected[j])
			{
				bool ok = true;
				for (int k = 0; k < 26; k++)
					if (presented[k] && !selected[k] && les[j][k])
					{
						ok = false;
						break;
					}

				if (!ok) continue;

				selected[j] = true;
				res = (char) (j+'A') + res;
				for (int k = 0; k < 26; k++)
					if (presented[k] && !selected[k] && les[k][j]) les[k][j] = false;
			}
	}

	cout << res << endl;
	return 0;
}
